package java111;

import java.util.*;

public class Day9 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            StringBuilder sb = new StringBuilder(a + "");
            sb.reverse();
            for (int i = 3; i < sb.length(); i += 4) {
                sb.insert(i, ",");
            }
            if (sb.charAt(sb.length() - 1) == ',') {
                sb.deleteCharAt(sb.length() - 1);
            }
            System.out.println(sb.reverse());
        }
    }


    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int a = in.nextInt();
            int[] dp = new int[a + 1];
            if (a == 0 || a == 1) {
                System.out.println(1);
                continue;
            }
            dp[0] = dp[1] = 1;
            for (int i = 2; i < a + 1; i++) {
                dp[i] = dp[i - 1] + dp[i - 2];
            }
            System.out.println(dp[a]);
        }
    }


    public boolean IsContinuous(int[] numbers) {
        // 解法2：不会出现重复元素，max-min <= 4

        Arrays.sort(numbers);
        int count = 0; // 表示0的个数
        for (int i = 0; i < numbers.length; i++) {
            if (numbers[i] == 0) {
                count++;
            } else {
                if (i - 1 < 0 || numbers[i - 1] == 0) {
                    continue;
                }
                if (numbers[i] == numbers[i - 1]) {
                    return false;
                }
                int differ = numbers[i] - numbers[i - 1] - 1;
                if (differ > count) {
                    return false;
                } else {
                    count -= differ;
                }
            }
        }
        return true;
    }
}

